package UI;

import java.awt.Color;
import java.awt.Font;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.net.URL;

import javax.swing.ImageIcon;
import javax.swing.JLabel;

public class StartButton extends JLabel implements MouseListener{
	
	private Main main;
	
	public StartButton(Main container){
		super();
		main = container;
		URL u = getClass().getResource("/data/images/splash.png");
		//String u = "./data/images/splash.png";
		this.setIcon(new ImageIcon(u));
		this.setText("Start");
		this.setForeground(Color.white);
		this.setVerticalTextPosition(JLabel.CENTER);
		this.setHorizontalTextPosition(JLabel.CENTER);
		this.setFont(new Font(this.getFont().getFontName(), this.getFont().getStyle(),24));
		this.addMouseListener(this);
	}

	@Override
	public void mouseClicked(MouseEvent arg0) {
		// TODO Auto-generated method stub
		
	}

	@Override
	public void mouseEntered(MouseEvent arg0) {	
		this.setForeground(Color.yellow);
		repaint();
	}

	@Override
	public void mouseExited(MouseEvent arg0) { 
		this.setForeground(Color.white);
	}

	@Override
	public void mousePressed(MouseEvent arg0) {
		System.out.println("Initialising game...");
		main.initGame();
	}

	@Override
	public void mouseReleased(MouseEvent arg0) {
	}

}
